package cn.hftoday.util;

import java.util.UUID;

/**
 * Guid generator
 * @author lane.cn@gmail.com
 *
 */
public class Guid {
	private static final String _empty = "00000000-0000-0000-0000-000000000000";
	private String id;
	
	private Guid(String id) {
		this.id = id;
	}
	
	/**
	 * empty Guid
	 * @return
	 */
	public static Guid getEmpty() {
		return new Guid(_empty);
	}
	
	/**
	 * generator Guid
	 * @return
	 */
	public static Guid getGuid() {
		UUID uuid = UUID.randomUUID();
		return new Guid(uuid.toString().toLowerCase());
	}
	
	/**
	 * convert to string
	 */
	public String toString() {
		return id;
	}
}
